﻿namespace Microsoft.SharePoint.Client
{
    using System;
    using System.ComponentModel;

    [ScriptType("SP.ChangeUser", ServerTypeId="{9bcb7adb-5a47-426e-886f-3ce841554cd9}")]
    public class ChangeUser : Change
    {
        [EditorBrowsable(EditorBrowsableState.Never)]
        public ChangeUser(ClientRuntimeContext Context, ObjectPath ObjectPath) : base(Context, ObjectPath)
        {
        }

        protected override bool InitOnePropertyFromJson(string peekedName, JsonReader reader)
        {
            bool flag = base.InitOnePropertyFromJson(peekedName, reader);
            if (!flag)
            {
                string str = peekedName;
                if (str == null)
                {
                    return flag;
                }
                if (!(str == "UserId"))
                {
                    if (str == "Activate")
                    {
                        flag = true;
                        reader.ReadName();
                        base.ObjectData.Properties["Activate"] = reader.ReadBoolean();
                    }
                    return flag;
                }
                flag = true;
                reader.ReadName();
                base.ObjectData.Properties["UserId"] = reader.ReadInt32();
            }
            return flag;
        }

        [Remote]
        public bool Activate
        {
            get
            {
                base.CheckUninitializedProperty("Activate");
                return (bool) base.ObjectData.Properties["Activate"];
            }
        }

        [Remote]
        public int UserId
        {
            get
            {
                base.CheckUninitializedProperty("UserId");
                return (int) base.ObjectData.Properties["UserId"];
            }
        }
    }
}

